package zxs.sino.elite.hub.controller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import zxs.sino.elite.hub.model.vo.app.UserVo;
import zxs.sino.elite.hub.service.app.ArticleService;
import zxs.sino.elite.hub.service.app.UserService;
import zxs.sino.elite.hub.utils.R;

import java.util.List;

/**
 * 无登录可访问
 *
 * @author zhang
 * @date 2025-07-06 10:27:17
 */
@RestController
@RequestMapping("api")
@RequiredArgsConstructor
public class ApiController {

    private final UserService userService;

    private final ArticleService articleService;



    /**
     * 获取优质活跃创作者
     * @return
     */
    @GetMapping("/user/premiumActiveCreators")
    public R getPremiumActiveCreators(){
        List<UserVo> users = userService.getPremiumActiveCreators();
        return R.ok().put("data",users);
    }

    /**
     * 获取优质创作者
     * @return
     */
    @GetMapping("/user/premiumCreators")
    public R getPremiumCreators(){
        List<UserVo> users = userService.getPremiumActiveCreators();
        return R.ok().put("data",users);
    }

    /**
     * 获取活跃创作者
     * @return
     */
    @GetMapping("/user/activeCreators")
    public R getActiveCreators(){
        List<UserVo> users = userService.getPremiumActiveCreators();
        return R.ok().put("data",users);
    }


    /**
     * 获取新晋创作者
     * @return
     */
    @GetMapping("/user/newCreators")
    public R getNewCreators(){
        List<UserVo> users = userService.getPremiumActiveCreators();
        return R.ok().put("data",users);
    }

    /**
     * 获取用户信息
     */
    @GetMapping("/user/info")
    public R getUserInfo(){
        UserVo user = userService.getUserInfo(null);

        return R.ok().put("data",user);
    }

    /**
     * 获取用户信息
     */
    @GetMapping("/user/detail/{userId}")
    public R getUserDetailInfo(@PathVariable Long userId){
        UserVo user = userService.getUserInfo(userId);

        return R.ok().put("data",user);
    }


    @GetMapping("/article/list")
    public R getArticleList(){

        return R.ok();
    }
}
